
var form,table,element,layer;
layui.use(['layer','jquery', 'form', 'table', 'element'], function() {
    form = layui.form;
    table = layui.table;
    element = layui.element;
    layer = layui.layer;
    var $ = layui.$;

    //修改密码
    $(document).on('click', '#safety_edit', function(data) {
        layer.open({
            type: 2,
            title: false,
            area: ['480px', '300px'],
            anim: 2,
            content: ['/admin/access/to_password'], //iframe的url，no代表不显示滚动条
            end: function () { //
            }
        });
    });

 });


 function logout() {
    layer.confirm('确认退出？', function(index){

        $.get("/admin/access/logout", (res) => {
            if (res.code == 200) {
                layer.msg('退出成功!',{icon:1});
                setTimeout(() => {
                    window.location.href = '/'
                }, 1000);
                //icon 1绿√ 2红叉 3问号 4密码锁 5不开心 6开心
            } else {
                layer.msg('退出失败:'+res.error+' -- '+res.code,{icon:2});
            }
        });

        layer.close(index);
    });



}
